function qs = ElnqX_Z_losses(vars)

% E[ln p(X|Z)]

D = size(vars.R, 2);
[N K] = size(vars.Z);
Dlog2pi = D*log(2*pi);

logdetE = vars.logdetE;

q = -D - Dlog2pi - logdetE;
q = q*0.5;

qs = zeros(1, K);
for k = 1:K
    comps = [1:(k-1) (k+1):K];
    Z = vars.Z(:, comps) + realmin;
    Z = Z./(sum(Z, 2)*ones(1, K-1));
    
    qs(k) = sum(sum(Z.*q(:, comps)));
end
